<?php
/**
 * Description:
 *
 * @author      Eden
 * @datetime    2017/1/9 09:17
 * @copyright   WuHan HuQi Technology Co.,Ltd.
 * @url         http://cnhuqi.com
 */

class Home extends WX_Controller
{

    const PAGE_SIZE = 20;

    /**
     * 初始化
     * @throws Exception
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 列表
     */
    public function waterFlow()
    {
       $send['state'] = true;
        do {
            $page = $this->input->get('page');
            $page = empty($page) || intval($page) <= 0 ? 1 : intval($page);

            $this->load->model('wx/Home/List_Model', 'list');
            $res = $this->list->getLists($this->userid, $this->userType, ($page - 1) * self::PAGE_SIZE, self::PAGE_SIZE);
            if (!$res) {
                $send['data'] = [
                    'total' => 0,
                    'data' => []
                ];
            } else {

                $send['data'] = [
                    'total' => $this->list->getTotal(),
                    'data' => $res
                ];
            }

        } while(false);
        $this->output->send($send);
    }

}

